home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-03-24 | 17.1 KB | 269 lines | [TEXT/ALFA] |
-
- Glossary
- --------
-
-
- A glossary of QForth words. The format is:
-
-
- <word> ( <stack-before> -- <stack-after> )
-
- <description of the word>
-
-
- ===============================================================================
-
- ! ( n addr -- )
-
- Store a 16-bit value (n) and the address given (addr).
-
- Ex: variable foo ( define foo )
- 3422 foo ! ( put the number 3422 into foo )
-
-
- " ( -- )
-
- Delimiter to mark the end of a string, used with ." and lit".
-
-
- ' ( -- addr )
-
- Places the address of the next word on the stack.
-
- Ex: : hi ." Hello" cr ; ( define a simple word )
- variable foo ( make a variable )
- ' hi foo ! ( save the address of hi's code in foo )
- foo @ execute ( causes hi to be run )
-
- ( ( -- )
-
- Begins a comment.
-
-
- ) ( -- )
-
- Ends a comment. Everything between ( and ) is ignored.
-
-
- * ( n m -- m*n )
-
- Multiply two 16-bit : nada 34 >r 56 . r> . ; displays 56 34
-
-
- r@ ( -- n )
-
- Copy the top return stack value to the stack. Does not remove it.
-
- Ex: : nada 34 >r 56 . r@ . r> . ; displays 56 34 34
-
-
- read ( -- )
-
- Compile the source file whose name follows. No spaces allowed in the
- name.
-
- Ex: read intro ( compile the intro file )
-
-
- repeat ( -- )
-
- Finish a WHILE loop. Colon definition only.
-
- Ex: begin key 13 <> while ." nope" cr repeat
-
-
- rot ( a b c -- b c a )
-
- Rotate top three stack items.
-
-
- space ( -- )
-
- Print a space. Equivalent to 32 emit
-
-
- spaces ( n -- )
-
- Print n spaces.
-
-
- span ( -- n )
-
- Return the number of characters read during the most recent 'expect'.
-
-
- string ( -- )
-
- Compile a string into the dictionary, delimited by a ~.
-
- Ex: create s string foobar~
- s 3 + c@ emit gives b
-
-
- swap ( a b -- b a )
-
- Switch the top two stack values.
-
-
- true ( -- -1 )
-
- Leave a -1 on the stack.
-
-
- u. ( n -- )
-
- Unsigned print of top of stack.
-
- Ex: -1 . gives -1
- -1 u. gives 65535
-
-
- u< ( n m -- 0 or -1 )
-
- Unsigned less than comparison.
-
-
- until ( f -- )
-
- Colon definition only. The bottom part of a BEGIN UNTIL loop. The
- loop exits when f is true.
-
- Ex: : ex begin key dup emit 13 = until ;
- display characters until return pressed.
-
-
- variable ( -- )
-
- Create a dictionary entry for a variable with the next word as the name.
-
- Ex: variable sweet-pea
- 1 sweet-pea !
-
-
- while ( f -- )
-
- Colon definition only. In a BEGIN WHILE REPEAT loop WHILE executes the
- part between WHILE and REPEAT as long as f is true.
-
- Ex: : ex begin key dup 13 <> while emit repeat ;
-
-
- words ( -- )
-
- Display a list of all the defined words in the order in which they were
- defined.
-
-
- xor ( n m -- 0 or -1 )
-
- Logical XOR (exclusive-OR) of n and m. Return -1 (true) if either n or
- m is non-zero but return 0 if both n and m true. One or the other but
- not both.
-
-
- xreg ( -- addr )
-
- Return the address of the xreg variable. The value of xreg is loaded
- into the X register just before an EXECUTE.
-
-
- yreg ( -- addr )
-
- Return the address of the yreg variable. The value of yreg is loaded
- into the Y register just before an EXECUTE.
-
-
- ===============================================================================
-
- The following words are available after the file 'extend.4th' has been
- loaded.
-
-
-
- depth ( -- n )
-
- Depth of the QForth stack, excluding n.
-
-
- !pen ( x y -- )
-
- Move the graphics pen to screen coordinates x , y
-
-
- -to ( x y -- )
-
- Draw a line from the current graphics pen position to x , y
-
-
- plot ( x y -- )
-
- Plot the point at screen coordinates x,y
-
-
- color ( n -- )
-
- Set the drawing color. 0 = black 4 = cyan
- 1 = red 5 = magenta
- 2 = green 6 = yellow
- 3 = blue 7 = white
-
- All other colors are black.
-
-
- @mouse ( -- x y b )
-
- Return the current mouse position and button status (0 or -1).
-
-
- ?button ( -- 0 or -1 )
-
- Return the status of the mouse button, 0 = up, -1 = down.
-
-
- ?mouse ( -- x y )
-
- Return the current mouse position.
-
-
- mon ( -- )
-
- Start the MacQForth system monitor. Enter q to exit.
-
-
- seedRandom ( -- )
-
- Seed the random numbers in $FF8E and $FF8F.
-
-
- random ( n -- m )
-
- Return a random number between 0 and n-1 inclusive.
-
-
- rand ( -- 0..255 )
-
- Return a random number between 0 and 255.
-
-
- rand16 ( -- n )
-
- Return a random number between 0 and 65535.
-
-
- set-start ( addr -- )
-
- Set the image startup word to addr. When a memory image saved after
- set-start is executed is loaded the word at addr is run automatically.
-
- Ex: : go ..... ; ' go set-start
-
-
- de ( addr -- )
-
- Produce a disassembled listing of the machine code for the word whose
- address is on the stack. Do not use with non-colon definition words.
-
-
- R@ ( -- n )
-
-